<script setup>
import { defineModel, ref } from 'vue'
import { artGetChannelsService } from '@/api/article'
defineProps({
  width: {
    type: String
  }
})
const modelValue = defineModel()
const channelList = ref([])
const getChannelList = async () => {
  const { data } = await artGetChannelsService()
  channelList.value = data
}
getChannelList()
</script>
<template>
  <el-form-item label="文章分类：">
    <el-select v-model="modelValue" :style="{ width }">
      <el-option
        v-for="item in channelList"
        :key="item.id"
        :label="item.name"
        :value="item.id"
      ></el-option>
    </el-select>
  </el-form-item>
</template>
<style scoped>
.el-select {
  width: 214px;
}
</style>
